package com.luoqiz.design.singleton.type7;

public class SingletonTest07 {
    public static void main(String[] args) {
        Singleton singleton1 = Singleton.INSTACE;
        Singleton singleton2 = Singleton.INSTACE;

        System.out.println("singleton1 hashcode:" + singleton1.hashCode());
        System.out.println("singleton2 hashcode:" + singleton2.hashCode());
        singleton1.method1();
    }
}

//枚举方法   推荐
enum Singleton {
    INSTACE;

    public void method1() {
        System.out.println("枚举方法   推荐");
    }

}